1. Technical Field
The present invention relates to a controller, and more specifically, to a technique of monitoring data transmitted and received between a controller configuring an FA system and a device/apparatus such as a remote device.
2. Related Art
The network system in FA (Factory Automation) has one or a plurality of PLCs (Programmable Logic Controller) responsible for the control of an input device and an output device of an industrial robot and other production facilities arranged inside a production factory, and a device which operation is controlled by the PLC connected to a network of a control system. The PLC and the device cyclically communicate through the network of the control system to transmit and receive IN data and OUT data (hereinafter referred to as I/O data), and control the production facilities.
FIG. 1 shows one part of the network system. In the example, Ethernet (registered trademark) is used as a communication protocol, and a controller 1 such as the PLC and the motion controller and a remote device 2 transmit and receive the I/O data through a switching hub 3. The controller 1 includes a CPU 1a responsible for control, a memory 11b for storing programs for the CPU 1a to operate, and a connection interface 1c for connecting to the network. The program stored in the memory 1b includes a system program for performing the basic operation, and a user control program (hereinafter also referred to as a user program) for actually performing the control. Other than the program, in the memory 1b, a work area used by the CPU 1a when executing the operation is ensured, and a memory area for storing the IO data and the like is ensured. A nonvolatile memory and a volatile memory are used for such memories depending on the application. As shown in the figure, the connection interface 1c includes an RJ45, which is a connector for attaching the terminal of a connection cable 5 complying with the communication protocol, a PT: pulse transformer, a PHY: physical layer, a Mac: media access controller, and the like.
The remote device 2 includes a connection connector 2a to the network such as the RJ45. The terminal of the communication cable 5 connected to the switching hub 3 is attached to the connection connector 2a to plug into the network. In FIG. 1, a plurality of remote devices 2 is drawn as if connected to one area of the switching hub 3 for the sake of convenience of illustration, but is connected to a plurality of ports arranged at the switching hub 3. The remote device 2 may further connect an external device 4 such as a motor if it operates on its own.
When failure occurs in the FA network system, the IO data is sometimes verified to analyze the cause etc. thereof. In this case, a protocol monitor 6 is connected to the network so that the IO data transmitted on the network is acquired at the protocol monitor 6, and the protocol monitor 6 performs analysis based on the acquired 10 data.
The protocol motor 6 includes a CPU 6a, a memory 6b, and a connection interface 6c with respect to the network. The connection interface 6c may have a configuration similar to that of the controller 1. The memory 6b includes a buffer area for storing system programs serving as a basic function for operating the protocol monitor 6, control conditions of the monitor function, and the acquired monitor data. The control conditions are set by the user or the technician specializing in network.
The monitor data buffer can automatically stop when receiving up to the buffer capacity, and can continue the operation continuously, as a ring buffer, to the control condition by discarding the data in order from the oldest. The monitor data of the monitor data buffer is generally saved as a file.
FIG. 2 shows an example of monitoring the IO data transmitted and received between the controller 1 and the servo driver, which serves as the remote device 2, in the network system. As shown in the figure, the controller 1, the remote device (servo driver) 2, and the protocol monitor 6 are connected to predetermined ports P1, P2, P3 of the switching hub 3. A port in the switching hub 3 is set as a mirror port and then the protocol monitor 6 is connected to such port for the protocol monitor 6 to acquire the data transmitted and received between the controller 1 and the remote device 2. The port P3 is the port set as the mirror port.
When set to such mirror port, all communication frame data transmitted and received at a certain port (port P2 connected with the remote device (servo driver) in the figure) are transferred to the mirror port (port P3). Thus, all communication frame data including the IO data can be captured by the protocol monitor by connecting the protocol monitor 6 to the mirror port.
FIG. 3 is a view showing a transmission/reception buffer structure of a driver unit in the protocol monitor 6, and a correlation of transmission/reception and transfer of the data. A reception buffer and a transmission buffer are ensured as a software structure of a general Ethernet (registered trademark) to realize a full-duplex communication (simultaneous execution of the reception process and the transmission process). The respective buffer generally forms a structure of the ring buffer by a plurality of buffer (eight, 0 to 7 in the figure) arrays, and a storage end pointer and a next storage pointer.
The function of the ring buffer will be described using the reception operation by way of example. The Ethernet controller provides the reception data mirrored and transferred from the switching hub 3 to the Ethernet driver unit (reception request). The Ethernet driver unit stores the reception data in the reception buffer (“reception buffer 6” in the figure) set with the next reception storage pointer by the reception request from the Ethernet controller. Thereafter, the next reception storage pointer is incremented by one to prepare for the next reception. The pointer is returned to the reception buffer 0 when reaching the end of the data array.
The high-order module (TCP/IP and frame monitor in the figure) reads out the reception data stored in the reception buffer (“reception buffer 2” in the figure) indicated with the reception storage end pointer at an arbitrary timing, and the read reception data is stored in the monitor data buffer in the memory 6c. Thereafter, the reception storage end pointer is incremented by one to prepare for the next reading. The pointer is returned to the reception buffer 0 when reaching the end of the data array. Therefore, continuous reception process is performed by assuming the data array as the ring structure by the data array and the process by the pointer. Such description is the same for the transmission process.
Therefore, the data transmitted and received between the controller 1 and the remote device 2 are stored in the monitor data buffer, and the analyzing function stored in the protocol monitor 6 is operated to analyze the data stored in the monitor data buffer. A management system using the protocol monitor is disclosed in Japanese Unexamined Patent Publication No. 2000-224184.